package com.compty.paint.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
 * @Todo:城市
 * @author: zhuqh
 * @CreateTime:2011-5-31 下午06:37:39
 */
@Entity
@Table(name = "t_cityinfo")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CityInfo implements java.io.Serializable {

	private static final long serialVersionUID = -7432630546810646813L;

	private Long id;

	/************ 城市名称 ****************/
	private String name;

	/************ 所属省 ****************/
	private ProvinceInfo provinceInfo;

	private List<RegionInfo> regionInfos = new ArrayList<RegionInfo>(0);

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", length = 100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="provinceid")
	public ProvinceInfo getProvinceInfo() {
		return provinceInfo;
	}

	public void setProvinceInfo(ProvinceInfo provinceInfo) {
		this.provinceInfo = provinceInfo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cityInfo")
	public List<RegionInfo> getRegionInfos() {
		return regionInfos;
	}

	public void setRegionInfos(List<RegionInfo> regionInfos) {
		this.regionInfos = regionInfos;
	}


	
	
	
}
